package com.flyduck.vueshop.search.h5.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.flyduck.vueshop.common.core.lang.Result;
import com.flyduck.vueshop.search.h5.service.H5EsProductService;
import com.flyduck.vueshop.search.h5.vo.H5EsProductRespVO;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * AppSearchController
 * </p>
 *
 * @author flyduck
 * @since 2024-05-24
 */
@RestController
@RequestMapping("/search/h5/esProduct")
public class H5EsProductController {

    @Resource
    private H5EsProductService h5EsProductService;

    @GetMapping("/getEsProductPage")
    public Result<Page<H5EsProductRespVO>> getEsProductPage(String keyword, HttpServletRequest request){
        int current = ServletRequestUtils.getIntParameter(request, "current",1);
        int size = ServletRequestUtils.getIntParameter(request, "size",10);

        Page<H5EsProductRespVO> appEsProductRespVOPage = h5EsProductService.getEsProductPage(keyword,current,size);
        return Result.success(appEsProductRespVOPage);
    }
}
